package com.patterns.demo.factoryMethod.ordinaryFactory.factory;

import com.patterns.demo.factoryMethod.ordinaryFactory.method.impl.MailSender;
import com.patterns.demo.factoryMethod.ordinaryFactory.method.impl.MessegeSender;
import com.patterns.demo.factoryMethod.ordinaryFactory.method.Sender;

/**
 * Author: SamGroves
 * <p>
 * Description: 普通工厂模式
 * <p>
 * Date: 2017/11/27
 */
public class SendFactory {

    public Sender produce(String type) {

        if ("mail".equals(type)) {

            return new MailSender();
        } else if ("messege".equals(type)) {

            return new MessegeSender();
        } else {

            System.out.println("请输入正确类型!");
            return null;
        }
    }
}
